package cn.com.wdjedu.androidapp.wjeduandroid.ui;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by samson on 26/11/2016.
 */

public class MainViewpage  extends ViewPager {

    private boolean scrollble=true;

    public MainViewpage(Context context){
        super(context);
//        mGestureDetector = new GestureDetector(context, new XScrollDetector());
    }

    public MainViewpage(Context context, AttributeSet attrs) {
        super(context, attrs);
//        mGestureDetector = new GestureDetector(context, new XScrollDetector());
    }



    public void setNoScroll(boolean noScroll) {
        this.scrollble = noScroll;
    }

    @Override
    public void scrollTo(int x, int y) {
        super.scrollTo(x, y);
    }

    @Override
    public boolean onTouchEvent(MotionEvent arg0) {
        /* return false;//super.onTouchEvent(arg0); */
        if (scrollble)
            return false;
        else
            return super.onTouchEvent(arg0);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
        if (scrollble)
            return false;
        else
            return super.onInterceptTouchEvent(arg0);
    }

    @Override
    public void setCurrentItem(int item, boolean smoothScroll) {
        super.setCurrentItem(item, smoothScroll);
    }



}



